package com.stars.home.vmodel

import android.app.Application
import android.graphics.Color
import android.text.TextUtils
import androidx.lifecycle.MutableLiveData
import com.stars.home.fragment.AccountBillFragment
import com.stars.home.model.AmountCount
import com.stars.home.model.User
import com.stars.home.utils.net.NetEngine
import com.trailer.base.base.BRRepository
import com.trailer.base.base.BRViewModel
import com.trailer.base.net.IResp

/**
 *
 *on 2020/9/18
 */
class WithListVModel(application: Application) : BRViewModel<BRRepository>(application) {


    val user: MutableLiveData<User?> = MutableLiveData(User.get())
    var info: MutableLiveData<AmountCount> = MutableLiveData<AmountCount>()

    var fragment: AccountBillFragment? = null
    var status = "0"




    fun  isShowTips(status:String?):String{
        if(!TextUtils.isEmpty(status)&&status.equals("0")){
            return "待审核"
        }
        if(!TextUtils.isEmpty(status)&&status.equals("1")){
            return "拒绝"
        }
        if(!TextUtils.isEmpty(status)&&status.equals("2")){
            return "提现完成"
        }

        return ""
    }

    fun  isShowTipsColor(status:String?):Int{
        if(!TextUtils.isEmpty(status)&&status.equals("0")){
            return Color.parseColor("#FFBC00")
        }
        if(!TextUtils.isEmpty(status)&&status.equals("1")){
            return Color.parseColor("#FA4646")
        }
        if(!TextUtils.isEmpty(status)&&status.equals("2")){
            return Color.parseColor("#2C7EEA")
        }

        return Color.parseColor("#FFBC00")

    }


    override fun apiFunc(): suspend () -> IResp<*> {


        return {
            NetEngine.service.driverProfit("1", "10", repository().page)
        }
    }
}
